package org.zhouhe.web.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import org.zhouhe.tools.FreemarkerUtils;

public class ButtonSubmitChecked extends TagSupport {
	private static final long serialVersionUID = 1L;

	private String label;
	private String url;
	private String icon;
	private String submitColumns;
	
	public int doStartTag() throws JspException {
		SimplePage pageTag = (SimplePage) this.getParent().getParent();
		try {
			String eventName = pageTag.getId()+"_submit_checked_"+ pageTag.newSubmitCheckedIndex();
			String iconCls = icon==null ? "":" iconCls='"+ icon +"' ";
			pageTag.addButton("<a href='javascript:void(0)' class='easyui-linkbutton' "+ iconCls +" plain='true' onclick='submitCheckedRows(\""+ url +"\", \""+ submitColumns +"\")'>"+ label +"</a>");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return SKIP_BODY;
	}

	public int doEndTag() throws JspException {
		return EVAL_PAGE;
	}
	
	public String getLabel() {
		return label;
	}
	public void setLabel(String label) {
		this.label = label;
	}
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getSubmitColumns() {
		return submitColumns;
	}

	public void setSubmitColumns(String submitColumns) {
		this.submitColumns = submitColumns;
	}
}
